package com.siki.vo.enterprise;


import com.siki.pojo.commonEntity.TalentPosition;
import com.siki.pojo.enumeration.common.EducationClaim;
import com.siki.pojo.enumeration.common.PositionCategory;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import java.util.List;
import java.util.Optional;

/**
 * @Author Siki
 * @Date 2020/6/19
 */
@ApiModel("岗位信息VO")
@Getter
@Setter
@NoArgsConstructor
public class TalentPositionInfoVO {
    @ApiModelProperty("id")
    Long id;

    @ApiModelProperty(value = "职位名称")
    private String positionName;

    @ApiModelProperty(value = "职位的类别")
    private String positionCategory;

    @ApiModelProperty(value = "最高工资")
    private String maximumWage;

    @ApiModelProperty(value = "最低工资")
    private String minimumWage;

    @ApiModelProperty(value = "工作地点")
    private String workPlace;

    @ApiModelProperty(value = "学历要求")
    private String educationClaim;

    @ApiModelProperty(value = "职位特点")
    private String positionFeatures;

    @ApiModelProperty(value = "职位描述")
    private String positionDescription;

    @ApiModelProperty("是否发布")
    Boolean released;

    public TalentPositionInfoVO(TalentPosition talentPositions){
        Optional.ofNullable(talentPositions).ifPresent(talentPosition -> {
            this.positionName=talentPosition.getPositionName();
            this.positionCategory = Optional.ofNullable(talentPosition.getPositionCategory()).map(PositionCategory::getName).orElse(null);
            this.maximumWage = talentPosition.getMaximumWage();
            this.minimumWage = talentPosition.getMinimumWage();
            this.workPlace = talentPosition.getWorkPlace();
            this.educationClaim = Optional.ofNullable(talentPosition.getEducationClaim()).map(EducationClaim::getName).orElse(null);
            this.positionFeatures = talentPosition.getPositionFeatures();
            this.positionDescription = talentPosition.getPositionDescription();
            this.released = talentPosition.getReleased();
        });
    }
}
